<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@include file="/common/taglibs.jspf" %>
<!DOCTYPE html>
<head>
	<title>审批范围选择框</title>
	<meta name="decorator" content="form"/>
</head>
<body>
	<div class="layui-row">
		<div class="layui-col-xs12">
			<grid:grid rownumbers="true" id="actUserList" url="${appPath}/act/model/getUserList" pageId="SYS:actUserList">
				<grid:column label="userNo"  name="userNo"  hidden="true" />
				<grid:column label="orgId"  name="orgId"  hidden="true" />
				<grid:column label="类型"  name="userType" dict="actUserType"  query="true" queryMode="select" queryValue="${fns:getOrgId()}" width="100"/>
				<grid:column label="名称"  name="userName"  query="true" condition="like" width="100"/>
				<grid:column label="归属"  name="orgName" dict="whether"  />
				<grid:toolbar  function="search" />
				<grid:toolbar title="确定" icon="icon-ok" function="choose"/>
			</grid:grid>
		</div>
	</div>
	<script>
		/**
		 * 切换用户类型select事件
		 */
		layui.use(['form'], function(){
			var form = layui.form;
			form.on('select(searchFilter)', function(data){
				$("#search-from").submit();
			});
		});

		//确定选择
		function choose() {
            //父级搜索表单
            var userTab=$(parent.document.getElementById("flowSetForm")).find("#userTab tbody");
            var html ="";
            var ids=$('#actUserListGrid').jqGrid('getGridParam','selarrrow');
            $.each(ids,function () {
                var rowData = $("#actUserListGrid").jqGrid('getRowData', this);
                html+="<tr id='"+this+"'>";
                html+="  <td>"+rowData.userType+"</td>";
                html+="  <td style='display: none'>";
                html+="  	<input name='userTypes' value='"+rowData.userType+"'/>";
                html+="  	<input name='userIds' value='"+rowData.userNo+"'/>";
                html+="  </td>";
                html+="  <td>"+rowData.userName+"</td>";
                html+='<td><button type="button" onclick="delUser(this)" class="btn btn-xs btn-white btn-danger"><i class="fa fa-trash-o"></i> 删 除 </button></td>';
                html+="</tr>";
            })
            userTab.append(html);
            closeThisWindow();
        }
	</script>
</body>
</html>